package ch.fusun.baron.server.rmi;

/**
 * Server phases
 */
public enum ServerPhase {
	/**
	 * Server is starting up.
	 */
	SERVERSTARTUP(false, false, false, false, false, false),
	/**
	 * Pre-game phase. Clients are allowed to register and log in. Server is
	 * being configured by admin. No updates are sent to clients.
	 */
	LOBBY(true, true, true, false, false, true),
	/**
	 * Game is starting up
	 */
	GAMESTARTUP(false, false, false, false, false, false),
	/**
	 * Game started, no registering is possible anymore. Users are updated by
	 * changes.
	 */
	GAME(true, true, false, true, true, false);

	private boolean login;
	private boolean logout;
	private boolean createUser;
	private boolean doCallbacks;
	private boolean execute;
	private boolean startGame;

	ServerPhase(boolean login, boolean logout, boolean createUser,
			boolean doCallbacks, boolean execute, boolean startGame) {
		this.login = login;
		this.logout = logout;
		this.createUser = createUser;
		this.doCallbacks = doCallbacks;
		this.execute = execute;
		this.startGame = startGame;
	}

	/**
	 * @return Is the login allowed in this phase?
	 */
	public boolean loginAllowed() {
		return this.login;
	}

	/**
	 * @return Is the logout allowed in this phase?
	 */
	public boolean logoutAllowed() {
		return logout;
	}

	/**
	 * @return Is creating a user allowed in this phase?
	 */
	public boolean createUserAllowed() {
		return this.createUser;
	}

	/**
	 * @return Are callbacks allowed in this phase?
	 */
	public boolean doCallbacksAllowed() {
		return this.doCallbacks;
	}

	/**
	 * @return Is execution allowed in this phase?
	 */
	public boolean executeAllowed() {
		return this.execute;
	}

	/**
	 * @return Is starting the game allowed in this phase?
	 */
	public boolean startGameAllowed() {
		return this.startGame;
	}

}
